//
//  BYWelcomeViewController.m
//  School+
//
//  Created by Sean Sebastian on 4/22/16.
//  Copyright © 2016 Sean Sebastian. All rights reserved.
//

#import "BYWelcomeViewController.h"

#import "UserAccount.h"

#import "BYBaseTableViewController.h"

#import "AppDelegate.h"



@interface BYWelcomeViewController ()

@end

@implementation BYWelcomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self prepareUI];
    
    self.view.backgroundColor = [UIColor whiteColor];
    [UIView animateWithDuration:2 animations:^{
        
        CGRect temp = self.lable.frame;
        temp.origin.y = self.view.bounds.size.height/2 - 40;
        self.lable.frame = temp;
        
        
    } completion:^(BOOL finished) {
        
        sleep(1);
        
        [(AppDelegate *)[UIApplication sharedApplication].delegate toTheMain];
    }];
}

- (void)prepareUI
{
    
//    CGPoint temp = self.view.center;
//    temp.x = self.view.frame.size.width / 2;
//    temp.y = -100;
//    self.lable.center = temp;

 
    
    
    [self.view addSubview:self.imageView];
    [self.view addSubview:self.lable];

}

- (UIImageView *)imageView
{
    if (_imageView == nil) {
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
        imageView.image = [UIImage imageNamed:@"1"];
        _imageView = imageView;
        return imageView;
    }
    return _imageView;

}

- (UILabel *)lable
{
    if (_lable == nil) {
        UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(self.view.bounds.size.width/2, 0 , 0 , 0)];
        lable.text = @"欢迎回来";
        lable.textColor = [UIColor whiteColor];
        lable.font = [UIFont systemFontOfSize:30];
        
        [lable sizeToFit];
        
        
        _lable = lable ;
        return lable;
    }
    return _lable;
}

@end
